package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.HashMap;

/**
 * 攻略
 */
@Getter@Setter@ToString
public class Strategy extends BaseDomain {
    public static final Integer STATE_HOT = 1;//热门
    public static final Integer STATE_COMMON = 0;//普通
    public static final Integer STATE_DISABLE = -1;//禁用
    private Region place;//地区

    private String title;//标题

    private String subTitle;//副标题

    private String coverUrl;//背景

    private Integer state = STATE_COMMON;//状态

    public String getStateName(){
        String stateName = "推荐";
        if (STATE_COMMON.equals(state)) {
            stateName = "普通";
        }else if (STATE_DISABLE.equals(state)) {
            stateName = "禁用";
        }
        return stateName;
    }

    public String getJson(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        if (place != null) {
            map.put("placeId",place.getId());
        }
        map.put("state",state);
        return JSONUtil.toJSONString(map);
    }
}